package com.avengers.common.bean.enums;

import java.util.LinkedHashMap;

/**
 * @author yu.wang
 * @since 10/10/23 11:33 AM
 **/
public enum AreaType {
    /**
     * 国家
     */
    country(1, "国家"),
    province(2, "省份"),
    city(3, "城市"),
    translation(9, "别名");

    public final Integer value;
    public final String comment;

    AreaType(Integer value, String comment) {
        this.value = value;
        this.comment = comment;
    }

    public static String of(Integer value) {
        for (AreaType areaType : values()) {
            if (areaType.value.equals(value)) {
                return areaType.comment;
            }
        }
        return null;
    }

    public static LinkedHashMap<Integer, String> getTypeList() {
        LinkedHashMap<Integer, String> finalMap = new LinkedHashMap<>();
        for (AreaType areaType : values()) {
            finalMap.put(areaType.value, areaType.comment);
        }
        return finalMap;
    }
}
